package net.wanho.controller;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * Author：汤小洋
 * Date：2023-07-26 13:52
 * Description：<描述>
 */
@Controller
@RequestMapping("/products")
public class ProductController {

    @RequiresRoles({"admin"})
    @RequestMapping("/add")
    public String add(){
        Subject subject = SecurityUtils.getSubject();
        if(subject.isPermitted("user:add")){
            System.out.println("添加特价商品。。。。。。");
        }else{
            System.out.println("添加普通商品。。。。。。");
        }
        return "index";
    }

    @RequiresPermissions("user:*:*")
    @RequestMapping("/list")
    public String list(){

        System.out.println("查询商品。。。。。。");
        return "index";
    }

}
